package fr.sedoo.metadata.shared.domain.misc;

import fr.sedoo.commons.client.util.LocaleUtil;

public class Iso6392LanguageConverter {

	public static final String ENGLISH = "eng";
	public static final String FRENCH = "fre";
	public static final String PORTUGUESE = "por";
	public static final String SPANISH = "spa";

	public static String convertLocaleToIso6392(String language) {
		if (language.compareToIgnoreCase(LocaleUtil.ENGLISH) == 0) {
			return ENGLISH;
		}
		if (language.compareToIgnoreCase(LocaleUtil.FRENCH) == 0) {
			return FRENCH;
		} else {
			return language;
		}
	}

	public static String convertIso6392Tolocale(String language) {
		if (language.compareToIgnoreCase(ENGLISH) == 0) {
			return LocaleUtil.ENGLISH;
		}
		if (language.compareToIgnoreCase(FRENCH) == 0) {
			return LocaleUtil.FRENCH;
		} else {
			return language;
		}
	}

}
